<template>
	<view>
		<u-popup :show="show" round="20rpx" @close="show = false">
			<view class="content">
				<view class="title">发布</view>
				<view class="ctn-box mt6">
					<view
						:class="['func-item center shrink0 active_bg', `zoom${index + 5}`]"
						v-for="(item, index) in publists"
						:key="index"
						@click="comditionNav(item)"
					>
						{{ item.label }}
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import { checkLogin, navTo } from '@/core/app';

const show = defineModel('show', { type: Boolean, default: false });
const emits = defineEmits(['noLogin']);

const publists = [
	{ label: '发布车源', nav: 'pages/release/vehicle/index' },
	{ label: '发布询价', nav: 'pages/release/price-inquiry/form' },
	{ label: '发布求购', nav: 'pages/release/seek-buy' },
	{ label: '发布收购', nav: 'pages/release/takeover' },
	{ label: '发布批发', nav: 'pages/release/wholesale' }
];
function comditionNav(item) {
	if (!checkLogin()){
		emits('noLogin');
		return
	}
	navTo(item.nav);
	show.value = false;
}
</script>

<style scoped lang="scss">
.content {
	width: 749rpx;
	height: 353rpx;
	background: #ffffff;
	padding: 0rpx 29rpx;
	box-sizing: border-box;
	border-radius: 20rpx 20rpx 0 0;
	
	.ctn-box{
		display: flex;
		justify-content: flex-start;
		gap: 25rpx;
		flex-wrap: wrap;
		
		.func-item {
			width: 210rpx;
			height: 67rpx;
			background: #eef2f8;
			border-radius: 8rpx;
			font-weight: 400;
			font-size: 26rpx;
			color: #000000;
		}
	}
}

.title {
	font-weight: 600;
	font-size: 32rpx;
	color: #121212;
	padding: 34rpx 0rpx;
	box-sizing: border-box;
	text-align: center;
}
</style>
